package com.comac.print.component.app.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

/**
 * @Description 设置DO默认填充值
 * @Author yy
 * @Date 2022/4/10 13:41
 */
@Component
public class MybatisMetaObjectHandler implements MetaObjectHandler {

    private static final String DELETE_FLAG = "deleteFlag";

    @Override
    public void insertFill(MetaObject metaObject) {
        // 自动填入逻辑删除标识
        if (metaObject.hasGetter(DELETE_FLAG)) {
            this.fillStrategy(metaObject, DELETE_FLAG, false);
        }
    }

    @Override
    public void updateFill(MetaObject metaObject) {

    }

}
